# 用递归的方式画二叉树
# by Nasa 2022-6-24
import turtle as t
import time


def f(n, pen):
    if n == 0:
        return
    d = 10
    a = 20
    # pen=t.Pen()
    pen.fd(d*n)
    pen.left(a)
    f(n - 1, pen)
    pen.right(2 * a)
    f(n - 1, pen)
    pen.left(a)
    pen.backward(d*n)


if __name__ == '__main__':
    pen = t.Pen()
    pen.setheading(90)
    f(5, pen)
    time.sleep(3)
